package com.qf.swagger.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.DocumentationCache;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfigration {
    @Bean
    public Docket buildDocket(){
        final Docket docket = new Docket(DocumentationType.SWAGGER_2);
        docket.apiInfo(getApiInfo()).select().apis(RequestHandlerSelectors.basePackage("com.qf.swagger.controller")).build();

        return docket;
    }

    private ApiInfo getApiInfo() {
        return new ApiInfoBuilder().contact(new Contact("千锋教育","http://www.baidu.com","wenhualiu340@gmail.com"))
                .title("swagger项目")
                .version("0.0.1")
                .description("由swagger生成的项目接口文件")
                .build();
    }
}
